import 'package:flutter/material.dart';

class ButtonStyleTest extends StatelessWidget {
  const ButtonStyleTest({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("各种按钮")),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          ElevatedButton(
            child: Text("ElevatedButton"),
            onPressed: () => print(1),
          ),
          TextButton(child: Text("FlatButton"), onPressed: () => print(2)),
          OutlinedButton(
            child: Text("OutlineButton"),
            onPressed: () => print(3),
          ),
          IconButton(icon: Icon(Icons.thumb_up), onPressed: () => print(4)),
          ElevatedButton.icon(
            icon: Icon(Icons.send),
            label: Text("发送"),
            onPressed: () => print(5),
          ),
          OutlinedButton.icon(
            icon: Icon(Icons.add),
            label: Text("添加"),
            onPressed: () => print(6),
          ),
          TextButton.icon(
            icon: Icon(Icons.info),
            label: Text("详情"),
            onPressed: () => print(7),
          ),
          TextButton(
            style: ButtonStyle(
              backgroundColor: WidgetStateProperty.all(Colors.blue),
              overlayColor: WidgetStateProperty.all(Colors.blue[700]),
              shape: WidgetStateProperty.all(
                RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20.0),
                ),
              ),
            ),
            child: Text("自定义TextButton按钮"),
            onPressed: () => print(8),
          ),
          ElevatedButton(
            style: ButtonStyle(
              backgroundColor: WidgetStateProperty.all(Colors.blue),
              overlayColor: WidgetStateProperty.all(Colors.green),
              shape: WidgetStateProperty.all(
                RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20.0),
                ),
              ),
            ),
            child: Text("自定义ElevatedButton按钮"),
            onPressed: () => print(9),
          ),
        ],
      ),
    );
  }
}
